import React, { Component } from 'react'
import { connect } from 'react-redux'
class List2 extends Component {
  render() {
    return (
      <div>
        List2
        <button onClick = {() => {
          this.props.changeList()
        }} >改变数据</button>
        { this.props.list.map((item, index) => {
          return (
            <div key={index}> { item }</div>
          )
        })}
      </div>
    )
  }
}
export default connect((state) => {
  return { list: state.list }
}, (dispatch) => {
  return {
    changeList () {
      dispatch({ type: 'UPDATE_LIST', payload: [7, 8, 9] })
    }
  }
})(List2)